@extends('admin.layout.layout', ['row' => @$page])
@section('style')
    <style>
        .table .tth{
            background-color: rgba(0, 0, 0, 0.05);
            width: 150px;
            font-weight: bold;
        }
        .table .ttd{
            width: 350px;
        }
        .table .ttt{
            padding: 0;
        }
        .ttt .table{
            margin: 0;
        }
        .ttt .table img + p{
            text-align: center;
            margin: 10px 0 0;
        }
        .tst{
            color: #00b050;
            font-weight: 700;
            text-align: center;
            font-size: 1.25rem;
        }
    </style>
@endsection
@section('contain')


    <div class="portlet">
        <div class="portlet-title">
            <div class="caption">
                <x-portlet-breadcrumb :page="$page"></x-portlet-breadcrumb>
            </div>
            <div class="actions">
                {{--<div class="item">
                    <a href="/{{ request()->path() }}/create" class="btn btn-sm btn-primary">{{ ts('addnew') }}</a>
                </div>--}}
            </div>
        </div>

        <div>
            <table class="table s3">
                <tbody>
                <tr>
                    <td class="tth">{{ ts('id') }}</td>
                    <td class="ttd">
                        {{ $data->id }}
                    </td>
                    <td class="tth">{{ ts('precutid') }}</td>
                    <td class="ttd">
                        {{ $data->precut_id }}
                    </td>
                    <td class="tth">{{ ts('warrantyid') }}</td>
                    <td class="ttd">
                        @if($warranty->warranty_id)
                            <a href="/admin/warranty/{{ $warranty->id }}" class="text-primary">{{ $warranty->warranty_id }}</a>
                        @else
                            <span class="text-primary">{{ $warranty->warranty_id }}</span>
                        @endif
                    </td>
                </tr>
                <tr>
                    <td colspan="6" class="tst">{{ ts('CUSTOMER') }}</td>
                </tr>
                <tr>
                    <td class="tth">{{ ts('CUSTOMERNAME') }}</td>
                    <td class="bg-light">
                        <span class="text-primary">{{ $warranty->first_name ?: ts('PLACEHOLDERMSG') }}</span>
                    </td>
                    <td class="tth">{{ ts('phonenumber') }}</td>
                    <td class="bg-light">
                        <span class="text-primary">{{ $warranty->extension }} {{ $warranty->phone_number ?: ts('PLACEHOLDERMSG') }}</span>
                    </td>
                    <td class="tth">{{ ts('email') }}</td>
                    <td class="bg-light">
                        <span class="text-primary">{{ $warranty->email_address ?: ts('PLACEHOLDERMSG') }}</span>
                    </td>
                </tr>
                <tr>
                    <td class="tth">{{ ts('region') }}</td>
                    <td class="bg-light">
                        <span class="text-primary">{{ ts('region_master.'.$warranty->region_id) ?: ts('PLACEHOLDERMSG') }}</span>
                    </td>
                    <td class="tth">{{ ts('province') }}</td>
                    <td class="bg-light">
                        <span class="text-primary">{{ ts('province_master.'.$warranty->province_id) ?: ts('PLACEHOLDERMSG') }}</span>
                    </td>
                    <td class="tth">{{ ts('city') }}</td>
                    <td class="bg-light">
                        <span class="text-primary">{{ ts('cities.'.$warranty->city) ?: ts('PLACEHOLDERMSG') }}</span>
                    </td>
                </tr>
                <tr>
                    <td class="tth">{{ ts('addresss') }}</td>
                    <td class="bg-light" colspan="3">
                        <span class="text-primary">{{ $warranty->address ?: ts('PLACEHOLDERMSG') }}</span>
                    </td>
                    <td class="tth">{{ ts('zip') }}</td>
                    <td class="bg-light">
                        <span class="text-primary">{{ $warranty->zip ?: ts('PLACEHOLDERMSG') }}</span>
                    </td>
                </tr>
                <tr>
                    <td colspan="6" class="tst">{{ ts('VEHICLEINFORMATION') }}</td>
                </tr>
                <tr>
                    <td class="tth">{{ ts('year') }}</td>
                    <td class="bg-light">
                        <span class="text-primary">{{ $warranty->year_id ?: ts('PLACEHOLDERMSG') }}</span>
                    </td>
                    {{--<td>{{ $data->year_id }}</td>--}}
                    <td class="tth">{{ ts('make') }}</td>
                    <td class="bg-light">
                        <span class="text-primary">{{ ts('make_master.'.$warranty->make_id) ?: ts('PLACEHOLDERMSG') }}</span>
                    </td>
                    {{--<td>{{ ts('make_master.'.$data->make_id) }}</td>--}}
                    <td class="tth">{{ ts('model') }}</td>
                    <td class="bg-light">
                        <span class="text-primary">
                            {{ (ts('model_master.'.$warranty->model_id) ?: $warranty->model_id) ?: ts('PLACEHOLDERMSG') }}
                            {{--{{ $warranty->model_id ?: ts('PLACEHOLDERMSG') }}--}}
                        </span>
                    </td>
                    {{--<td>{{ $data->model_id }}</td>--}}
                </tr>
                <tr>
                    <td class="tth">{{ ts('licenseplate') }}</td>
                    <td class="bg-light">
                        <span class="text-primary">{{ $warranty->license_plate ?: ts('PLACEHOLDERMSG') }}</span>
                    </td>
                    {{--<td class="bg-light">{{ ts('PLACEHOLDERMSG') }}</td>--}}
                    <td class="tth">{{ ts('vinnumber') }}</td>
                    <td class="bg-light">
                        <span class="text-primary">{{ $warranty->vin_number ?: ts('PLACEHOLDERMSG') }}</span>
                    </td>
                    <td colspan="2"></td>
                </tr>
                <tr>
                    <td colspan="6" class="tst">{{ ts('INSTALLATIONINFORMATION') }}</td>
                </tr>
                <tr>
                    <td class="tth">{{ ts('qudao') }}</td>
                    <td colspan="5">{{ getJc($data->user_id) }}</td>
                </tr>
                <tr>
                    <td class="tth">{{ ts('INSTALLERNAME') }}</td>
                    <td class="bg-light">
                        <span class="text-primary">{{ $warranty->installer_name ?: ts('PLACEHOLDERMSG') }}</span>
                    </td>
                    <td class="tth">{{ ts('INSTALLATIONDATE') }}</td>
                    <td class="bg-light">
                        <span class="text-primary">{{ fdate($warranty->installation_date) ?: ts('PLACEHOLDERMSG') }}</span>
                    </td>
                    <td class="tth">{{ ts('INSTALLERPRICE') }}</td>
                    <td class="bg-light">
                        <span class="text-primary">{{ $warranty->installation_price ?: ts('PLACEHOLDERMSG') }}</span>
                    </td>
                </tr>
                <tr>
                    <td colspan="6" class="tst">{{ ts('INSTALLATIONPICTURE') }}</td>
                </tr>
                <tr>
                    <td colspan="6" class="ttt" style="min-height: 30px">
                        <x-warranty-image :warranty="$warranty"></x-warranty-image>
                        {{--@include('admin.subview.aztp-tb', ['data'=>$warranty])--}}
                    </td>
                </tr>
                <tr>
                    <td colspan="6" class="tst">{{ ts('VEHICLECOVERAGE') }}</td>
                </tr>
                <tr>
                    <td colspan="6" class="ttt">
                        <table class="table text-center">
                            <thead>
                            <tr>
                                <th>{{ ts('PART') }}</th>
                                <th>{{ ts('ROLLNUMBER') }}</th>
                                <th>{{ ts('LENGTH') }}</th>
                                <th>{{ ts('FILMTYPE') }}</th>
                                <th>{{ ts('FILMWIDTH') }}</th>
                                <th>{{ ts('PRECUTORMANUAL') }}</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach(getPrecutCoverages($data->id) as $v)
                                <tr>
                                    <td>{{ ts('part_master.'.$v->part_id) }}</td>
                                    <td>{{ $v->roll_number }}</td>
                                    <td>{{ $v->length }}</td>
                                    <td>{{ ts('film_type_master.'.$v->film_type_id) }}</td>
                                    <td>{{ $v->width }}</td>
                                    <td>{{ $v->precut_or_manual == 1 ? ts('precut') : ts('Manual') }}</td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td colspan="6" class="tst">{{ ts('BCSM') }}</td>
                </tr>
                <tr>
                    <td colspan="6" height="64">{{ $data->additional_comments }}</td>
                </tr>
                </tbody>
            </table>

            <div class="mt-4">
                @if(session('admin.user_type')==1)
                @else
                    @if($data->approved==3)
                        <a class="btn btn-warning" href="/{{ request()->path() }}/{{ $data->id }}/edit">{{ ts('edit') }}</a>
                        <span class="btn btn-primary" onclick="handleWFQSH({{ $data->id }})">{{ ts('FQSH') }}</span>
                    @elseif($data->approved==2)
                        <span class="btn btn-danger btn-sm" onclick="handleDelete({{ $data->id }})">{{ ts('delete') }}</span>
                    @endif
                @endif
            </div>
        </div>
        <h3 class="section_sub_title">{{ ts('ALLOCATEDRECORD') }}</h3>
        <table class="table table-s2 text-center">
            <thead>
            <tr>
                <th>{{ ts('sequence') }}</th>
                <th>{{ ts('YSD') }}</th>
                <th>{{ ts('ygmsmc') }}</th>
                <th>{{ ts('XSD') }}</th>
                <th>{{ ts('xgmsmc') }}</th>
                <th>{{ ts('CZ') }}</th>
                <th>{{ ts('EFFECTIVEDATE') }}</th>
            </tr>
            </thead>
            <tbody>
            @foreach($assign as $k=>$v)
                <tr>
                    <td>{{ $k+1 }}</td>
                    <td>{{ getDjc(@$v->sold_by_user_id) }}</td>
                    <td>{{ getJc(@$v->sold_by_user_id) }}</td>
                    <td>{{ getDjc(@$v->sold_to_user_id) }}</td>
                    <td>{{ getJc(@$v->sold_to_user_id) }}</td>
                    <td>{{ @$v->type == 1 ? ts('ASSIGN') : ts('tuihuo') }}</td>
                    <td>
                        {{ fdate2($v->created_at) }}
                    </td>
                </tr>
            @endforeach
            </tbody>
            </tfoot>
        </table>


    </div>


@endsection